package com.edu.exam.enums.core;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 评分系统枚举
 */
@Getter
@AllArgsConstructor
public enum GradingSystem {
    PERCENTAGE("PERCENTAGE", "百分制"),
    GPA("GPA", "绩点制"),
    LETTER_GRADE("LETTER_GRADE", "字母等级"),
    POINTS("POINTS", "分数制"),
    RATING("RATING", "评级制"),
    PASS_FAIL("PASS_FAIL", "通过/不通过"),
    QUALITATIVE("QUALITATIVE", "定性评价"),
    QUANTITATIVE("QUANTITATIVE", "定量评价");

    private final String code;
    private final String description;

    public static GradingSystem fromCode(String code) {
        for (GradingSystem system : values()) {
            if (system.getCode().equals(code)) {
                return system;
            }
        }
        return PERCENTAGE; // 默认返回百分制
    }
}